/*
 * This file is part of Catfish.
 * Copyright (C) 2010 Namazu Studios LLC
 * 
 * Catfish is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of 
 * the License, or (at your option) any later version.
 * 
 * Catfish is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with Catfish.  If not, please visit:
 *  
 * http://www.gnu.org/licenses/
 *  
 */
package com.namazustudios.catfish.validator;

/**
 * Validates the data contained in a field just before it's put into the
 * datastore. This may be used to correct values put into the datastore or raise
 * an error when invalid data is attempted to be put into.
 * 
 * @author patricktwohig
 * 
 */
public interface Validator<T> {

	/**
	 * Validates the given value. The may throw an exception or it may return a
	 * valid value.
	 * 
	 * @param value
	 *            the input value
	 * @return the validated value
	 * @throws ValidationFailure
	 *             if the validation fails
	 */
	public T validate(T value) throws ValidationFailure;

}
